from com.Linux.AcquireLinSymInfo import AcquireLinSymInfo


class CPUMsg(AcquireLinSymInfo):
    def __init__(self, hostname, port, name, password):
        # 调用父类的构造器
        super(CPUMsg, self).__init__(hostname, port, name, password)
        # 定义私有成员
        self.__cpu_msg_dic = super().get_allCPUInformation()

    # CPU的个数  如何CPU数量少于1个  那么返回False
    def get_count_CPUNum(self):
        if int(self.__cpu_msg_dic['processor']) >= 0:
            cpu_num = int(self.__cpu_msg_dic['processor']) + 1
            return cpu_num
        else:
            return True

    # cpu的基本信息 en为英文
    def get_detailedCPUMsg_en(self):
        cpu_detailed_dic = {'vendor_id': self.__cpu_msg_dic.get('vendor_id'),
                            'cpu family': self.__cpu_msg_dic.get('cpu family'),
                            'model': self.__cpu_msg_dic.get('model'),
                            'model name': self.__cpu_msg_dic.get('model name'),
                            'stepping': self.__cpu_msg_dic.get('stepping')
                            }
        return cpu_detailed_dic

    # cpu的基本信息 cn为中文
    def get_detailedCPUMsg_cn(self):
        cpu_detailed_dic = {'CPU制造商': self.__cpu_msg_dic.get('vendor_id'),
                            'CPU产品系列代号': self.__cpu_msg_dic.get('cpu family'),
                            'CPU属于其系列中的哪一代的代号': self.__cpu_msg_dic.get('model'),
                            'CPU属于的名字及其编号、标称主频': self.__cpu_msg_dic.get('model name'),
                            'CPU属于制作更新版本': self.__cpu_msg_dic.get('stepping')
                            }
        return cpu_detailed_dic
